<div style="text-align: center" id="paginator">
  <div class="laypage-main">
    {% if queryset.has_previous %}
    <a href="#" class="laypage-prev" data-page="{{ queryset.number|add:-1 }}">上一页</a>
    {% endif %}
    {% for pg in page_range %}
        {% if queryset.number == pg %}
            <span class="laypage-curr">{{ pg }}</span>
        {% else %}
            <a href="#" data-page="{{ pg }}">{{ pg }}</a>
        {% endif %}
    {% empty %}
        <a href="#" data-page="1">{{ queryset.number }}</a>
    {% endfor %}
    {% if queryset.has_next %}
        <a href="#" class="laypage-next" data-page="{{ queryset.number|add:1 }}">下一页</a>
    {% endif %}
  </div>
</div>
<script>
    var queryConfig = getQueryString();
    $("#paginator").find('a').each(function () {
        queryConfig.page = $(this).data("page");
        $(this).attr('href', "?" + setQueryString(queryConfig));
    })
</script>
